home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
245
/
gfatip16
/
fsel_inp.lst
next >
Wrap
File List
|
1988-10-10
|
5KB
|
159 lines
' GFATIP16 .LST Library Source Code is Copyright 1988 Marathon Computer Press
' Procedure: Fsel_input
' Dependencies : Get_drive, Strip_file_path, Getrez
'
' This procedure requires that you supply either a file name or a legal
' file extension. IE.. either ( "*.BAS", or "MYPROG.BAS" ). This value must
' be declared in the string variable Supply$. Flag% is set to one if you want
' the Fsel_title$ to appear above the standard Fileselector box. This works
' ONLY with the Standard Fileselector, or the UIS. Most of the Public Domain
' fileselectors we've seen are too large and will obscure the title placard.
' However:
' The rest of the Fsel_input procedure code will work with ANY fileselector!
' It's up to you if you want to use the placard above the box. If you
' do, remember to set Flag% to 1
'
'
'
' Example:
' Supply$="\*.BAS"
' @Fsel_input(Supply$,Fsel_title$,Flag%)
'
'
' Returned values:
' Fsel$ = The chosen file name
' Full_path$ = Full selected path
' Currentdrive$ = Current drive
' Path$ = File path only, minus the chosen file
'
' Considerations:
' This procedure allows for the "Sticky Setting" of file paths. However, if
' you desire to return to the original drive, you should include the following
' code to accomplish a return to a "Home drive".
'
' @Get_drive
' Old_drive%=Gfadrive%
' Oldpath$=Dir$(0)
' If Oldpath$=""
' Oldpath$="\"
' Endif
'
' ** Next we do our call to Fsel_input **
' Supply$="\*.BAS"
' @Fsel_input(Supply$)
'
' ** Next you do what you want with the chosen
' file and drive (if changed)
' ' Write the file or read the file
'
' ** Now to return to our old settings **
' Chdrive Old_drive%
' Chdir Oldpath$
'
' We may also pass in a Title for the Fileselect Box if desired. It is passed
' to the procedure in the text string Fsel_title$. In order to use the option
' you must also turn on the usage flag. Do not try to center the text, this
' will be done for you. Also, you are limited to 35 characters in length. If
' the passed Fsel_title$ is longer, it will be truncated.
'
'
' Supply$="\*.BAS"
' Fsel_title$=" Write a File "
' Flag%=1 ! 1=On, 0=Off
' @Fsel_input(Supply$,Fsel_title$,Flag%)
'
'
'
'
Procedure Fsel_input(Supply$,Fsel_title$,Flag%)
'
@Getrez
Clr Nowhere$,Fsel$
@Get_drive
If Left$(Supply$,1)<>"\"
Supply$="\"+Supply$
Endif
'
' ** The next section is optional for the Fsel_title **
' You can remove the section without damaging the rest of the
' routine.
'
' Get Resolution information and draw the box accordingly. We only support
' medium and high resolution, so if the routine is used with low resolution
' you will have to modify it a bit.
'
If Flag%=1 ! Check to see if it's active ** Med or High Rez Only **
If Rez%=2
Get 175,30,465,53,Tempuse$ ! Get the background and save it.
Graphmode 1
Deftext 1,0,0,13
Defline 1,1
Deffill 0,2,8
Pbox 175,30,465,53
Box 175,30,465,53
' Now for some centering
'
Temp%=Len(Fsel_title$)
Temp2%=35-Temp%
Temp$=Space$(Temp2%/2)
Clr Temp%,Temp2%
Fsel_title$=Temp$+Fsel_title$
Text 180,50,Fsel_title$
'
Else ! Medium Resolution
'
Get 170,10,465,23,Tempuse$ ! Get the background and save it.
Graphmode 1
Deftext 1,0,0,6
Defline 1,1
Deffill 0,2,8
Pbox 170,10,465,23
Box 170,10,465,23
' Now for some centering
'
Temp%=Len(Fsel_title$)
Temp2%=35-Temp%
Temp$=Space$(Temp2%/2)
Clr Temp%,Temp2%
Fsel_title$=Temp$+Fsel_title$
Text 175,20,Fsel_title$
Endif
Endif
'
'
'
'
Repeat
Fileselect Currentdrive$+":"+Dir$(0)+Supply$,File$,Nowhere$
Exit If Nowhere$=""
Until Len(Nowhere$)<>1
If Nowhere$<>"" Then
Currentpath$=Dir$(0)
If Currentpath$=""
Currentpath$="\"
Endif
@Strip_file_path
@Get_drive
If Newdrive%<>0
Chdrive Newdrive%
Endif
Chdir Path$
Endif
Full_path$=Nowhere$
'
'
If Flag%=1
' If you are using Fsel_title$ do not remove this
' However, if you have not removed Get X,Y,X2,Y2,Tempuse$
' You program WILL crash if you leave this in.
If Rez%=2
Put 175,30,Tempuse$,3 ! Overwrite the title placard
Else
Put 170,10,Tempuse$,3
Endif
Clr Tempuse$
Endif
'
'
Return